//
//  DFHeadheadViewCell.m
//  DFMessage
//
//  Created by lanou on 15/10/24.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "DFHeadheadViewCell.h"
#import "DFHeadheadLineModel.h"
#import "UIImageView+WebCache.h"
#import "DFSignlTon.h"
@implementation DFHeadheadViewCell

- (void)awakeFromNib {
    
    
}



-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    
      if (self) {
    
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0 , kScreenWidth, 170)];
        _scrollView.contentSize = CGSizeMake(kScreenWidth*4, 170);
        _scrollView.pagingEnabled = YES;
          
          
        for (int i = 0; i <3; i ++) {
            _imgsrcImage = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenWidth *i , 0, kScreenWidth, 170)];
            [_scrollView addSubview:_imgsrcImage];
            
            _stitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5+kScreenWidth *i, 140, kScreenWidth, 30)];
            _stitleLabel.textColor = [UIColor whiteColor];
            _stitleLabel.textAlignment = NSTextAlignmentCenter;
            _stitleLabel.textColor = [UIColor blueColor];
       
            [_scrollView addSubview:_stitleLabel];
        }
          
          _btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
          _btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
          _btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
          _btn1.frame = CGRectMake(0, 0, kScreenWidth, 170);
          _btn2.frame = CGRectMake(kScreenWidth, 0, kScreenWidth, 170);
          _btn3.frame = CGRectMake(kScreenWidth * 2, 0, kScreenWidth, 170);
          [_scrollView addSubview:_btn1];
          [_scrollView addSubview:_btn2];
          [_scrollView addSubview:_btn3];
          

          [self addSubview:_scrollView];
    }
    return self;
 
}


-(void)setConfigureModel:(DFHeadheadLineModel *)configureModel{
   
    _configureModel = configureModel;
    
    DFSignlTon *signlTon = [DFSignlTon shareInstance];
    if (signlTon.savemode == SaveModeYes)
    {
        _imgsrcImage.image = [UIImage imageNamed:@""];
    }else
    {
        [_imgsrcImage sd_setImageWithURL:[NSURL URLWithString:configureModel.imgsrc]];
    }

    
    
    
    
    _stitleLabel.text = configureModel.stitle;
    
    
}


@end
